package com.lyh.dao;

import com.lyh.pojo.Category;
import com.lyh.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * 功能
 * 作者：lyh
 * 日期：2024/8/8 13:17
 */
public class CategoryDao {
    QueryRunner queryRunner = new QueryRunner(JDBCUtils.getDataSource());

    public List<Category> findAllTypes() throws SQLException {
        String sql = "select * from category";
        return queryRunner.query(sql,new BeanListHandler<>(Category.class));
    }
}
